<script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "8193578c-c353-4286-bb4d-95b303634274", doNotHash: false, doNotCopy: false, hashAddressBar: true});</script>
<div class="cl">
	<div class="content_holder fl">
		<div id="content">
			<div class="block_holder br5">
				<div class="tab_holder">
					<ul class="tabs cl">
						<li class="open"><?php echo Yii::t("main", "photo")?></li>
						<li class="openmaps"><?php echo Yii::t("main", "maps")?></li>
						<li class="openstreetview"><?php echo Yii::t("main", "street view")?></li>
						<li class="last"><?php echo Yii::t("main", "calendar")?></li>
					</ul>
					<ul class="tab_container">
						<li class="open">
						<!-- Slider -->
							<div id="photo_block">
								<div class="slider_container">
									<div class="slider_wrapper cl">
										<ul id="slider" class="cl ready">
											<?php if(count($model->images) == 0) : ?>
												<li><?php echo $this->material_image(0, 'noimage.gif', '619', ''); ?></li>
											<?php else : ?>
												<?php foreach ($model->images as $image) : ?>
													<li><?php echo $this->material_image($image->id, $image->name, '619', 'images/'.$model->user_id.'/'.$model->id); ?></li>
												<?php endforeach; ?>
											<?php endif ?>
										</ul>
									</div>
									<ul id="slider_thumbs" class="cl">
										<?php foreach ($model->images as $key => $image) : ?>
											<li class="<?php echo $key==0 ? 'current' : ''; ?>"><?php echo $this->material_image($image->id, $image->name, '110', 'images/'.$model->user_id.'/'.$model->id); ?></li>
										<?php endforeach; ?>
										
									</ul>
									<div class="prev"></div>
									<div class="next"></div>
								</div>
							</div>
							<!-- END Slider -->
						</li>
						<li>
							<div class="slider_wrapper">
								<div id="map_canvas" style="width:100%; height:100%"><?php echo $address; ?></div>
							</div>
						</li>
						<li>
							<div class="slider_wrapper">
								<div id="map_streetview" style="width:100%; height:100%"><?php echo $address; ?></div>
							</div>
						</li>
						<li>
					<!-- Calendar -->
							<div class="calendarBlock cl">
								<div class="calendar fl">
									<label>Select the month</label>
									<div class="select br3">
										<select>
											<option><?php echo Yii::t("main", "January")?></option>
											<option><?php echo Yii::t("main", "February")?></option>
											<option><?php echo Yii::t("main", "January")?></option>
											<option><?php echo Yii::t("main", "February")?></option>
										</select>
									</div>
									<table cellpadding="0" class="calendarTable" cellspacing="0">
										<thead>
											<tr>
												<th><?php echo Yii::t("main", "Sun")?></th>
												<th><?php echo Yii::t("main", "Mon")?></th>
												<th><?php echo Yii::t("main", "Tue")?></th>
												<th><?php echo Yii::t("main", "Wed")?></th>
												<th><?php echo Yii::t("main", "Thu")?></th>
												<th><?php echo Yii::t("main", "Fri")?></th>
												<th><?php echo Yii::t("main", "Sat")?></th>
											</tr>
										</thead>
										<tbody class="calendar">
										<?php echo $calendar_body; ?>
										</tbody>
									</table>
									<div class="subdes cl">
										<div> <span class="green"></span><?php echo Yii::t("main", "Choosen");?></div>
										<div> <span class="red"></span><?php echo Yii::t("main", "Busy");?></div>
									</div>
								</div>
								<div class="info fr">
									<p>
										<?php echo Yii::t("main", 
											"Календарь обновляется раз в пять минут и 
											является приблизительным. Мы советуем связаться с хозяином, чтобы 
											подтвердить свободные дни. Цены указаны за день.");
										?>
									</p>
								</div>
							</div>
							<!-- END Calendar -->
						</li>
					</ul>
				</div>
			</div>
			<div class="social_btns">
				<span class='st_facebook_hcount' displayText='Facebook'></span>
				<span class='st_googleplus_hcount' displayText='Google +'></span>
				<span class='st_twitter_hcount' displayText='Tweet'></span>
				<span class='st_linkedin_hcount' displayText='LinkedIn'></span>
				<span class='st_vkontakte_hcount' displayText='Vkontakte'></span>
				<span class='st_email_hcount' displayText='Email'></span>
			</div>
			<div class="block_holder br5">
				<div class="tab_holder">
					<ul class="tabs cl">
						<li class="open"><?php echo Yii::t("main", "description");?></li>
						<li><?php echo Yii::t("main", "amenities");?></li>
						<li class="last"><?php echo Yii::t("main", "house rules");?></li>
					</ul>
					<ul class="tab_container pn">
						<li class="open">
							<div class="descr_object_box cl">
								<div class="descr_object">
									<p>
										<?php echo CHtml::encode($model->description); ?>
									</p>
								</div>
								<div class="descr_table fr">
									<table>
										<tr>
											<td>
												<div><?php echo Yii::t("main", "Room type");?>:</div>
											</td>
											<td>
												<div><?php echo CSelect::item($model->room_type_id, "RoomType","name"); ?></div>
											</td>
										</tr>
										<tr>
											<td>
												<div><?php echo Yii::t("main", "Bed type");?>:</div>
											</td>
											<td>
												<div><?php echo CSelect::item($model->bed_type_id, "BedType","name"); ?></div>
											</td>
										</tr>
										<tr>
											<td>
												<div><?php echo Yii::t("main", "Accommodates");?>:</div>
											</td>
											<td>
												<div><?php echo CHtml::encode($model->accommodates); ?></div>
											</td>
										</tr>
										<tr>
											<td>
												<div><?php echo Yii::t("main", "Bedrooms");?>:</div>
											</td>
											<td>
												<div><?php echo CHtml::encode($model->bedrooms); ?></div>
											</td>
										</tr>
										<tr>
											<td>
												<div><?php echo Yii::t("main", "Extra people");?>:</div>
											</td>
											<td>
												<div>$<?php echo CHtml::encode($model->price_extra_people); ?> / night after <?php echo CHtml::encode($model->extra_people_guest); ?> guests</div>
											</td>
										</tr>
										<tr>
											<td>
												<div><?php echo Yii::t("main", "Minimum Stay");?>:</div>
											</td>
											<td>
												<div><?php echo CHtml::encode($model->minimum_stay); ?> nights</div>
											</td>
										</tr>
										<tr>
											<td>
												<div><?php echo Yii::t("main", "Security Deposit");?>:</div>
											</td>
											<td>
												<div>$<?php echo CHtml::encode($model->price_security_deposit); ?></div>
											</td>
										</tr>
										<tr>
											<td>
												<div><?php echo Yii::t("main", "Cleaning Fee");?>:</div>
											</td>
											<td>
												<div>$<?php echo CHtml::encode($model->price_clean); ?></div>
											</td>
										</tr>
										<tr>
											<td>
												<div><?php echo Yii::t("main", "Check In");?>:</div>
											</td>
											<td>
												<div><?php echo Yii::app()->dateFormatter->format("h:mm a",$model->check_in); ?></div>
											</td>
										</tr>
										<tr>
											<td>
												<div><?php echo Yii::t("main", "Check Out");?>:</div>
											</td>
											<td>
												<div><?php echo Yii::app()->dateFormatter->format("h:mm a",$model->check_out); ?></div>
											</td>
										</tr>
										<tr>
											<td>
												<div><?php echo Yii::t("main", "Country");?>:</div>
											</td>
											<td>
												<div><?php echo CSelect::item($model->country_id, "Country","name"); ?></div>
											</td>
										</tr>
										<tr>
											<td>
												<div><?php echo Yii::t("main", "City");?>:</div>
											</td>
											<td>
												<div><?php echo CSelect::item($model->city_id, "City","name"); ?></div>
											</td>
										</tr>
										<tr>
											<td>
												<div><?php echo Yii::t("main", "Neighborhood");?>:</div>
											</td>
											<td>
												<div><?php echo Yii::t("main", "Knightsbridge");?></div>
											</td>
										</tr>
										<tr>
											<td>
												<div><?php echo Yii::t("main", "Size");?>:</div>
											</td>
											<td>
												<div><?php echo CHtml::encode($model->size); ?>m2</div>
											</td>
										</tr>
										<tr>
											<td>
												<div><?php echo Yii::t("main", "Cancellation");?>:</div>
											</td>
											<td>
												<div><?php echo Yii::t("main", "Strict");?></div>
											</td>
										</tr>
									</table>
								</div>
							</div>
						</li>
						<li>
							<?php if($model->amenities) : ?>
								<ul class="amenities cl">
									<?php foreach ($model->amenities as $key => $amenity) : ?>
										<li><?php echo CHtml::encode($amenity->name->name); ?></li>
									<?php endforeach; ?>
								</ul>
							<?php else : ?>
								<p><?php echo Yii::t('main', 'There are no amenities'); ?></p>
							<?php endif ?>
						</li>
						<li>
							<div class="house_rules">
								<p>
									<?php echo CHtml::encode($model->house_rules); ?>
								</p>
							</div>
						</li>
					</ul>
				</div>
			</div>
			<div class="block_holder br5 cl">
				<div class="reviews">
					<h2><?php echo Yii::t("main", "Reviews"); ?></h2>
				<!-- NEW Comment -->
					<div id="comment_new">
						<?php $this->renderPartial('_commentsNew', array('object_id'=>$model->id, 'model'=>$model, 'review'=>$review, 'rating'=>$rating)); ?>
					</div>
					
					<!-- END New Comment -->
				<!-- Comments -->
					<ul id="comment_list">
						<?php $this->renderPartial('_commentsList', array('comments'=>$comments)); ?>
					</ul>
					<!-- END Comments -->

				</div>
			</div>
		</div>
	</div>
	<div id="right" class="br5">
		<div class="order_form">
				<div class="price_box cl">
					<div class="price fl">
						<label><?php echo Yii::t("main", "From")?></label>
						<span class=""><i>$</i> <?php echo CHtml::encode($model->price); ?></span> 
						<span class="hidden"><i>$</i> <?php echo CHtml::encode($model->price_week); ?></span> 
						<span class="hidden"><i>$</i> <?php echo CHtml::encode($model->price_month); ?></span> 
					</div>
					<div class="radio_time fr">
						<div class="radio_box cl">
							<input type="radio" name="r1" id="r1_id1" class="styled"  checked/>
							<label for="r1_id1"><?php echo Yii::t("main", "Per night")?></label>
						</div>
						<div class="radio_box cl">
							<input type="radio" name="r1" id="r1_id2" class="styled"/>
							<label for="r1_id2"><?php echo Yii::t("main", "Per week")?></label>
						</div>
						<div class="radio_box cl">
							<input type="radio" name="r1" id="r1_id3" class="styled" />
							<label for="r1_id3"><?php echo Yii::t("main", "Per month")?></label>
						</div>
					</div>
				</div>
					<div class="box form_def cl">
						<!-- <form action="#" method="post" id="form_check_booking"> -->
						<?php $form=$this->beginWidget('CActiveForm', array(
							'id'=>'form_check_booking',
							'enableAjaxValidation'=>false,
						)); ?>
							<div class="row cl">
								<div class="inp_col first fl">
									<?php echo $form->labelEx($booked,'check_in'); ?>
									<div class="inp_text">
										<?php echo $form->textField($booked,'check_in', array('class'=>'br3 bsi15 datePicker')); ?>
										<?php echo $form->error($booked,'check_in'); ?>
									</div>
								</div>
								<div class="inp_col fl">
									<?php echo $form->labelEx($booked,'check_out'); ?>
									<div class="inp_text">
										<?php echo $form->textField($booked,'check_out', array('class'=>'br3 bsi15 datePicker')); ?>
										<?php echo $form->error($booked,'check_out'); ?>
									</div>
								</div>
								<div class="inp_col sel fl">
									<label>Guests</label>
									<div class="select br3">
										<?php
											echo $form->dropDownList($booked,'guest', 
												array(
													'1'=>1,
													'2'=>2,
													'3'=>3,
													'4'=>4,
													'5'=>5,
													'6'=>6,
													'7'=>7,
													'8'=>8,
													'9'=>9,
												)
											);
										?>
									</div>
								</div>
							</div>
							<input type="hidden" name="object_id" value="<?php echo $model->id; ?>">
							<div class="row cl">
								<a href="#" class="btn green br5" id="booked">
									<?php echo Yii::t("main", "Book it")?><span></span><i></i>
								</a>
							</div>
						<!-- </form> -->
						<?php $this->endWidget(); ?>
				<!-- btn Bookmark -->
					<div class="box" id="bookmark">
						<?php $this->renderPartial('_bookmark', array('bookmark'=>$bookmark, 'object'=>$model->id, 'countBookmark'=>$model->countBookmark)); ?>
					</div>
					<!-- END btn Bookmark -->
					<div class="box">
						<div class="user_block">
							<div class="user_photo">
								<a href="<?php echo Yii::app()->createUrl('users/view', array('id'=>$user->id));?>">
									<?php echo $this->material_image($user->id, $user->avatar, '187', 'images/' . $user->id); ?>
								</a>
							</div>
							<div class="user_name"><?php echo CHtml::encode($user->full_name); ?></div>
							<div class="row">
								<?php if($model->user->id != Yii::app()->user->id) : ?>
									<a href="<?php echo Yii::app()->createUrl('users/viewMessage',array('companion'=>$user->id )); ?>" class="btn red br5">
										<?php echo Yii::t("main", "Contact me")?><span></span><i></i>
									</a>
								<?php endif ?>
							</div>
						</div>
					</div>
				<!-- Similar Listings -->
					<div class="box similar_holder">
						<h3><?php echo Yii::t("main", "Similar Listings")?></h3>
						<div class="similar_box">
							<ul id="similar_objects">
								<?php foreach ($similarListings as $key => $value) : ?>
									<li>
										<div class="title">
											<a href="<?php echo Yii::app()->createUrl('cataloge/view', array('id'=>$value->id)); ?>" title="">
												<?php echo CHtml::encode($value->name);?>
											</a>
										</div>
										<p>$<?php echo CHtml::encode($value->price); ?> <?php echo Yii::t("main", "per night")?></p>
										<p><?php echo CSelect::item($value->room_type_id, "RoomType","name"); ?></p>
										<div class="view br7">
											<a href="<?php echo Yii::app()->createUrl('cataloge/view', array('id'=>$value->id)); ?>">
												<?php if($value->mainImage){ ?>
													<?php echo $this->material_image($value->mainImage->id, $value->mainImage->name, '100', 'images/'.$value->user_id.'/'.$value->id); ?>
												<?php }else{ ?>
													<?php echo $this->material_image(0, 'noimage.gif', '100', ''); ?>
												<?php } ?>
											</a>
										</div>
										<div class="rating"><span></span><?php echo $value->GetAverageRatingNum(); ?></div>
									</li>
								<?php endforeach; ?>
							</ul>
						</div>
					</div>
					<!-- END Similar Listings -->
				</div>
			
		</div>
	</div>
</div>